<div class="row toolbar">
  <div class="col-md-6">
    <span class="toolbar-header">
      <%= @prescription.new_record? ? "#{t(:new_prescription)}" : "#{t(:edit)} #{(:prescription)}" %> 
    </span>
  </div>
  <div class="col-md-6 text-right">
    <ul class="toolbar-nav">
      <li><%= link_to simple_icon("note"), appointment_path(:id => params[:appointment_id]) %></li>
      <li><%= link_to simple_icon("notes"), appointment_path(:id => params[:appointment_id]) %></li>
    </ul>
  </div>
</div>

<%= form_for(@prescription, url:
if action_name == "edit" or action_name == "update" 
	appointment_prescription_path
else
	appointment_prescriptions_path
end
) do |f| %>
  <% if @prescription.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@prescription.errors.count, "error") %> prohibited this prescription from being saved:</h2>

      <ul>
      <% @prescription.errors.full_messages.each do |message| %>
        <li><%= message %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="form-group">
    <%= f.label :drug_id %><br>
    <%= collection_select(:prescription, :drug_id, Drug.all, :id, :name, prompt: true) %>
    <%= link_to feather_icon('circle-plus'), new_appointment_drug_path(:appointment_id => params[:appointment_id]) %>

  </div>
  <div class="form-group">
    <%= f.label :dosage %><br>
    <%= f.text_field :dosage %>
  </div>
  <div class="form-group">
    <%= f.label :quantity %><br>
    <%= f.text_field :quantity %>
  </div>
  <div class="form-group">
    <%= f.label :fee %><br>
    <%= f.text_field :fee %>
  </div>
  <div class="form-group">
    <%= f.label :note %><br>
    <%= f.text_area :note %>
  </div>
  <%= f.submit class: "btn btn-primary" %>
<% end %>
